package com.twu.biblioteca.helper;

import com.twu.biblioteca.exceptions.ArgumentError;

import java.util.InputMismatchException;

public class Scanner {
    private java.util.Scanner scanner;

    public Scanner(){
        scanner = new java.util.Scanner(System.in);
    }

    public Integer readInteger() throws ArgumentError {
        try {
            Integer anInteger = scanner.nextInt();
            scanner.nextLine();
            return anInteger;
        } catch (InputMismatchException error) {
            throw new ArgumentError();
        }
    }
}
